package de.kardass.jannobatch.examples.simple.second;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import de.kardass.jannobatch.ItemReader;
import de.kardass.jannobatch.examples.simple.data.SimpleInputItem;
import de.kardass.jannobatch.examples.simple.data.SimpleOutputItem;

public class SecondItemSupplier implements ItemReader<SimpleOutputItem> {

	private final List<SimpleOutputItem> list;

	public SecondItemSupplier() {
		super();
		this.list = new ArrayList<SimpleOutputItem>();
		list.add(new SimpleOutputItem(new SimpleInputItem(1, "eins"), "OUT"));
	}

	@Override
	public void onShutDown() {
		System.out.println("..." + getClass() + "-> finish");
	}

	@Override
	public void onStartUp() {
		System.out.println("..." + getClass() + "-> init");
	}

	@Override
	public Iterator<SimpleOutputItem> iterator() {
		System.out.println("..." + getClass() + "-> iterator...");
		return list.iterator();
	}

}
